package com.hjx.movie.core.system.service.admin.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hjx.movie.core.system.service.admin.IOrderService;
import com.hjx.movie.core.util.cache.CacheKey;
import com.hjx.movie.core.util.cache.CacheUtil;
import com.hjx.movie.persistence.system.mapper.IvyOrderMapper;
import com.hjx.movie.persistence.system.model.IvyOrder;
import com.hjx.movie.persistence.system.model.IvyRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>Title:</p>
 * <p>Description:</p>
 *
 * @author hjx
 * @date 2021/2/15 - 14:56
 */
@Slf4j
@Service
@Transactional
@CacheConfig(cacheNames = "IvyMovie:SpringCache:OrderCache",keyGenerator = "cacheKeyGenerator")
public class OrderService extends ServiceImpl<IvyOrderMapper, IvyOrder> implements IOrderService {

    @Override
    public boolean addOrder(IvyOrder order) {
        return save(order);
    }

    @Override
    public boolean updateOrder(IvyOrder order) {
        return updateById(order);
    }

    @Override
    public boolean deleteOrder(Long orderId) {
        return removeById(orderId);
    }

    @Override
    public List<IvyOrder> findAll() {
        return list();
    }
}
